#ifndef SOCKET_H
#define SOCKET_H

#include <sys/types.h>
#include <netinet/in.h>
#define _GNU_SOURCE
#include <sys/socket.h>
#include <unistd.h>

typedef struct S Socket;
struct S {
	int sockMaster, sockClient[3];
	int maxClients;
	struct timeval timeout;
	char buffer[2049]; /* 2k */
	fd_set readfds;

	struct sockaddr_in addr;
	struct sockaddr_in local_addr_info;
	struct sockaddr_in remote_addr_info;
	void (*init)(Socket *s);
	int (*getMessage)(Socket *this);
	int size;
	int status;
};

#define DEFAULT_PORT 22111
#define MAXLOG 5

Socket *makeSocket(void);

#endif


